#import "GKCover.h"
#import "dfhgwhruebvhrheyoutwarddelegate.h"
#import "dfhgwhruebvhrheyluggagerecorder.h"
#import "dfhgwhruebvhrheystaindental.h"
#import "dfhgwhruebvhrheyaluminiumdisorder.h"
#import "dfhgwhruebvhrheytragedymotivateViewController.h"
#import "dfhgwhruebvhrheyroomcatalogViewController.h"
#import "dfhgwhruebvhrheyprocessionattractiveViewController.h"
#import "dfhgwhruebvhrheylunarreceiptViewController.h"
#import "dfhgwhruebvhrheyqueuememorialViewController.h"
@interface dfhgwhruebvhrheylunarreceiptViewController ()
@property (weak, nonatomic) IBOutlet UILabel *tipsTextLabel;
@end
@implementation dfhgwhruebvhrheylunarreceiptViewController
- (void)viewDidLoad {
    [super viewDidLoad];
	[self loadUI];
}
- (void)loadUI {
	[self configBackIcon:@"dhgfywegwygeydwcurvereciprocal"];
	[self configRightIcon:@"navigation_right"];
	self.navigationItem.title = @"Delete Account";
	self.navigationStyle = dhgfywegwygeydwreciprocaltransport;
	NSString *tips = @"1、No outstanding orders and services in the account\n2、The account is currently a valid and unfrozen account.\n3、Identity and account information will be cleared and cannot be recovered\n4、Transaction history will be erased and cannot be recovered";
	NSMutableAttributedString *mattribute = [[NSMutableAttributedString alloc] initWithString:tips];
	NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
	style.lineSpacing = 5;
	[mattribute addAttributes:@{NSParagraphStyleAttributeName: style} range:NSMakeRange(0, tips.length)];
	self.tipsTextLabel.attributedText = mattribute;
}
- (void)deleteResult:(BOOL)success withReason:(NSString *)reason {
	dfhgwhruebvhrheyprocessionattractiveViewController *result = (dfhgwhruebvhrheyprocessionattractiveViewController *)[UIStoryboard storyboard:@"Mine" withidentifier:@"delete_result"];
	if (success) {
		result.reason = nil;
	}else {
		result.reason = reason;
	}
	[self.navigationController pushViewController:result animated:YES];
}
- (void)requestDelete:(NSString *)code {
	NSDictionary *params = @{
		@"password": code
	};
	__weak typeof(self) weakSelf = self;
	[[dfhgwhruebvhrheyluggagerecorder shareInstance] dhgfywegwygeydwbarrierawait:dhgfywegwygeydwlambbreast path:deleteAccountApi isEncrypt:YES withParams:params success:^(NSURLSessionDataTask * _Nonnull task, NSString * _Nonnull json) {
		__strong typeof(weakSelf) strongSelf = weakSelf;
		dfhgwhruebvhrheysternideology *model = [dfhgwhruebvhrheysternideology yy_modelWithJSON:json];
		if (model.code == 200) {
			[strongSelf deleteResult:YES withReason:nil];
		}else {
			[dfhgwhruebvhrheyoptionsaving.keyWindow show:model.error];
		}
	} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
		NSLog(@"=== %@",error);
	}];
}
- (void)surePopView {
	__weak typeof(self) weakSelf = self;
	dfhgwhruebvhrheystaindental *popView = [[NSBundle mainBundle] loadNibNamed:@"dfhgwhruebvhrheystaindental" owner:nil options:nil].firstObject;
	popView.frame = CGRectMake(37, 0, dhgfywegwygeydwdispositionvisualize-37*2, 351);
	[GKCover coverFrom:[dfhgwhruebvhrheyoptionsaving keyWindow] contentView:popView style:GKCoverStyleTranslucent showStyle:GKCoverShowStyleCenter showAnimStyle:GKCoverShowAnimStyleCenter hideAnimStyle:GKCoverHideAnimStyleCenter notClick:YES];
	[popView configure:@"Please complete the following certification" andTips:@"Please enter the registration password" withBtnsClick:^(UIButton * _Nonnull sender, NSString * _Nonnull code) {
		__strong typeof(weakSelf) strongSelf = weakSelf;
		[GKCover hideCover];
		if (sender.tag == 101) {
			[strongSelf requestDelete:code];
		}
		if (sender.tag == 200) {
            dfhgwhruebvhrheytragedymotivateViewController *forgetVC = [[dfhgwhruebvhrheytragedymotivateViewController alloc] init];
            forgetVC.canNotEditMobile = YES;
            forgetVC.mobile = [dfhgwhruebvhrheyoptionsaving getUserData].phone;
            [self.navigationController pushViewController:forgetVC animated:YES];
		}
	}];
}
- (IBAction)requestDeletionAction {
	__weak typeof(self) weakSelf = self;
	dfhgwhruebvhrheyaluminiumdisorder *popView = [[dfhgwhruebvhrheyaluminiumdisorder alloc] initWithFrame:CGRectMake(37, 0, dhgfywegwygeydwdispositionvisualize-37*2, 289)];
	[GKCover coverFrom:[dfhgwhruebvhrheyoptionsaving keyWindow] contentView:popView style:GKCoverStyleTranslucent showStyle:GKCoverShowStyleCenter showAnimStyle:GKCoverShowAnimStyleCenter hideAnimStyle:GKCoverHideAnimStyleCenter notClick:YES];
	[popView configure:@"Are you sure to delete the account?" andTips:@"After the account is canceled, all user data cannot be restored, please operate with caution." withBtnsClick:^(UIButton * _Nonnull sender) {
		__strong typeof(weakSelf) strongSelf = weakSelf;
		[GKCover hideCover];
		if (sender.tag == 101) {
			[strongSelf surePopView];
		}
	}];
}
@end
